export function getAuthority() {
  const auth = getAuthorization();
  return auth.length > 0 ? 'admin' : '';
}
export function setAuthority(authority) {
  return localStorage.setItem('antd-pro-authority', authority);
}

export function getAuthorization() {
  // 权限
  // return localStorage.getItem('token') || '';
  return localStorage.getItem('dqtoken') || '';
}

export function setAuthorization(authority) {
  return localStorage.setItem('dqtoken', authority);
}

export function onChangeMenuCode(mCode = '') {
  const dom = document.getElementById('mc');
  if (!dom) {
    const cDiv = document.createElement('div');
    cDiv.id = 'mc';
    cDiv?.setAttribute('m', mCode);
    document.body.appendChild(cDiv);
  } else {
    dom?.setAttribute('m', mCode);
  }
}

export function onGetMenuCode() {
  const dom = document.getElementById('mc');
  if (!dom) {
    return '';
  } else {
    return dom.getAttribute('m');
  }
}
